package ofc4j.model.elements;

import java.util.Arrays;
import java.util.List;

import ofc4j.model.metadata.Alias;

public class LineChart extends Element {
    private static transient final Integer DEFAULT_FONTSIZE = 10;
    
    private Integer width;
    @Alias("dot-size") private Integer dotSize;
    @Alias("halo-size") private Integer haloSize;
    private String colour;
    
    public LineChart() {
        this(Style.NORMAL);
    }
    
    public LineChart(Style style) {
        this(style.getStyle());
    }
    
    protected LineChart(String type) {
        super(type);
        setFontSize(DEFAULT_FONTSIZE);
    }

    public Integer getWidth() {
        return width;
    }

    public LineChart setWidth(Integer width) {
        this.width = width;
        return this;
    }

    public Integer getDotSize() {
        return dotSize;
    }

    public LineChart setDotSize(Integer dotSize) {
        this.dotSize = dotSize;
        return this;
    }

    public String getColour() {
        return colour;
    }

    public LineChart setColour(String colour) {
        this.colour = colour;
        return this;
    }
    
    public LineChart addValues(Number... values) {
        getValues().addAll(Arrays.asList(values));
        return this;
    }
    
    public LineChart addValues(List<Number> values) {
        getValues().addAll(values);
        return this;
    }
    
    public Integer getHaloSize() {
        return haloSize;
    }

    public LineChart setHaloSize(Integer haloSize) {
        this.haloSize = haloSize;
        return this;
    }
    
    public static enum Style {
        NORMAL("line"),
        DOT("line_dot"),
        HOLLOW("line_hollow");
        
        private String style;
        
        Style(String style) {
            this.style = style;
        }
        
        public String getStyle() {
            return style;
        }
    }
}
